package com.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.common.utils.PageUtils;
import com.common.utils.Query;
import com.dao.MultiQuestionDao;
import com.entity.MultiQuestionEntity;
import com.service.MultiQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service("multiQuestionService")
public class MultiQuestionServiceImpl extends ServiceImpl<MultiQuestionDao, MultiQuestionEntity> implements MultiQuestionService {

    @Autowired
    private MultiQuestionDao multiQuestionDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<MultiQuestionEntity> page = this.page(
                new Query<MultiQuestionEntity>().getPage(params),
                new QueryWrapper<MultiQuestionEntity>()
                        .or().like("questionid",params.get("key"))
                        .or().like("subject",params.get("key"))
                        .or().like("level",params.get("key"))
                        .or().like("section",params.get("key"))
        );

        return new PageUtils(page);
    }

    @Override
    public List<MultiQuestionEntity> getAllList() {
        return multiQuestionDao.selectList(new QueryWrapper<>());
    }


}